<?php

namespace Ignus\View\Node;

use Ignus\View\Node;
use Ignus\View\Compiler;
use Ignus\View\NodeOutputInterface;

class Text extends Node implements NodeOutputInterface
{
    public function __construct($data, $lineno)
    {
        parent::__construct(array(), array('data' => $data), $lineno);
    }

    public function compile(Compiler $compiler)
    {
        $compiler
            ->addDebugInfo($this)
            ->write('echo ')
            ->string($this->getAttribute('data'))
            ->raw(";\n");
    }
}
